#include <stdio.h>
int my_max(int a[], int a_length, int x)
{
    int max = a[0];
    for (int i = 1; i < a_length; i++)
    {
        if (max <= a[i])
            max = a[i];
    }
    x = (x == max) ? 1 : 0;
    return x;
}
int my_min(int a[], int a_length, int x)
{
    int min = a[0];
    for (int i = 1; i < a_length; i++)
    {
        if (min >= a[i])
            min = a[i];
    }
    x = (x == min) ? 1 : 0;
    return x;
}

int main()
{
    int x;
    int a[6][6] = {0};
    int col[6][6] = {0};
    scanf("%d", &x);
    for (int i = 0; i < x; i++)
    {
        for (int j = 0; j < x; j++)
        {
            scanf("%d", &a[i][j]);
        }
    }
    for (int j = 0; j < x; j++)
    {
        for (int i = 0; i < x; i++)
        {
            col[j][i] = a[i][j];
        }
    }
    int count = 0;
    for (int i = 0; i < x; i++)
    {
        for (int j = 0; j < x; j++)
        {
            if (my_max(a[i], x, a[i][j]) && my_min(col[j], x, a[i][j]))
            {
                printf("(%d,%d)\n", i, j);
                count++;
            }
        }
    }
    if (count == 0)
        printf("NONE\n");
    return 0;
}